<!-- components/ActivityList.vue -->
<template>
  <div class="activity-list">
    <el-card 
      v-for="(activity, index) in filteredActivities" 
      :key="index" 
      class="activity-card mb-4"
    >
      <h3 class="activity-title">{{ activity.title }}</h3>
      <p class="activity-desc">{{ activity.description }}</p>
      <div class="activity-footer">
        <span class="activity-date">时间：{{ formatDate(activity.date) }}</span>
        <el-button type="primary" size="small" class="activity-btn">查看详情</el-button>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import { ref, computed } from 'vue';

interface Activity {
  title: string;
  description: string;
  date: string;
  status: number;
}

const props = defineProps<{
  status: number;
}>();

const activities = ref<Activity[]>([
  { title: '清明祭祖', description: '春季例行祭祀活动', date: '2024-04-05', status: 1 },
  { title: '族谱修订', description: '第23次族谱编纂工作', date: '2024-12-01', status: 0 },
  { title: '中秋诗会', description: '传统诗词吟诵活动', date: '2024-09-15', status: -1 }
]);

const filteredActivities = computed(() => 
  activities.value.filter(a => a.status === props.status)
);

function formatDate(dateString: string) {
  const date = new Date(dateString);
  return `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`;
}
</script>

<style lang="scss" scoped>
.activity-card {
  background: #fff;
  border: 1px solid #d4c1b3;
  border-radius: 0.8rem;
  padding: 1.2rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
  
  &:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  }
}

.activity-title {
  font-size: 1.3rem;
  color: #964b00;
  font-weight: bold;
  margin-bottom: 0.8rem;
  position: relative;
  padding-left: 1.2rem;
  
  &::before {
    content: '·';
    position: absolute;
    left: 0;
    color: #e74c3c;
    font-size: 1.8rem;
    line-height: 1;
  }
}

.activity-desc {
  color: #5a4a3a;
  line-height: 1.6;
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

.activity-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.8rem;
  border-top: 1px dashed #e0d6c8;
}

.activity-date {
  color: #a98c72;
  font-size: 0.95rem;
}

.activity-btn {
  background: #964b00;
  border-color: #964b00;
  border-radius: 0.4rem;
  font-weight: 500;
  
  &:hover {
    background: #a85c11;
    border-color: #a85c11;
  }
}
</style>